<%@page import="cs4280.bean.Member"%>
<jsp:useBean id="member" type="cs4280.bean.Member" scope="session"/>
<script type="text/javascript">

    function doUpdate(){
        if( document.getElementById("password").value==""||document.getElementById("password2").value==""||
            document.getElementById("password").value!=document.getElementById("password2").value)
        {
            alert("Please keep the passwords same to be updated.");
            return false;
        }
        else{

            document.getElementById("userinfo").todo.value = "doupdateUser";
            return true;
        }
    }

</script>
<form name="userinfo" id="userinfo" onsubmit="return doUpdate()" action="/assignmentCinema/">
    <input type="hidden" id="todo" name="todo"/>
    <input type="hidden" id="username" name="username" value="<jsp:getProperty name="member" property="username"/>"/>
    <h2>User info</h2>
    <table>
        <tbody>
            <tr>
                <td>User name</td>
                <td><jsp:getProperty name="member" property="username"/></td>
            </tr>
            <tr>
                <td>New Password</td>
                <td><input type="password" name="password" id="password"/></td>

            </tr>
            <tr>
                <td>Re-enter Password</td>
                <td><input type="password" name="password2" id="password2"/></td>

            </tr>

        </tbody>
    </table>
    <input type="submit" value="Update"/>
</form>